import { ApiProperty } from '@nestjs/swagger';
import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity()
export class PaymentOrder {
  @PrimaryGeneratedColumn()
  id: number;

  @ApiProperty({ description: '用户id' })
  @Column()
  userId: string;

  @ApiProperty({
    description: '交易状态, 0未支付,1已支付,2已过期,3已取消,4已退款',
  })
  @Column()
  payStatus: number;

  // @ApiProperty({ description: '订单号' })
  // @Column()
  // orderCode: string;

  @ApiProperty({ description: 'apple交易订单id' })
  @Column()
  transactionId: string;

  // @ApiProperty({ description: 'app票据' })
  // @Column()
  // appReceipt: string;

  @CreateDateColumn({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' })
  createdAt: string;

  @UpdateDateColumn({
    type: 'timestamptz',
    default: () => 'CURRENT_TIMESTAMP',
    onUpdate: 'CURRENT_TIMESTAMP',
  })
  updatedAt: string;
}
